package com.lx.pc.service.quotationanalysis.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.stereotype.Service;

import com.lx.pc.domain.entity.quotationanalysis.QuotationanalysisEntity;
import com.lx.pc.domain.vo.quotationanalysis.QuotationanalysisVo;
import com.lx.pc.mybatis.repository.quotationanalysis.QuotationanalysisRepository;
import com.lx.pc.service.AbstractService;
import com.lx.pc.service.quotationanalysis.IQuotationanalysisService;
import com.lx.pc.utils.OmsPage;

@Service("quotationanalysisService")
public class QuotationanalysisServiceImpl extends AbstractService<QuotationanalysisEntity, QuotationanalysisVo, BigInteger, QuotationanalysisRepository> implements IQuotationanalysisService{

	@Override
	public int findByQuotationanalysisCount(QuotationanalysisVo quotationanalysis) {

		return repository.findByQuotationanalysisCount(quotationanalysis);
	}

	@Override
	public OmsPage<QuotationanalysisVo> findByQuotationanalysis(QuotationanalysisVo quotationanalysis, Integer page,
			Integer size) {

		OmsPage<QuotationanalysisVo> pages = new OmsPage<QuotationanalysisVo>();
		pages.setTotal(repository.findByQuotationanalysisCount(quotationanalysis));
		List<QuotationanalysisEntity> list = repository.findByQuotationanalysis(quotationanalysis,page = (page - 1) * size,size);
		pages.setResult(etoV(list));
		return pages;
	}

	@Override
	public QuotationanalysisVo findByQuotationanalysisId(BigInteger id) {

		return etoV(repository.findByQuotationanalysisId(id));
	}

}
